$gwx_XC_25=function(_,_v,_n,_p,_s,_wp,_wl,$gwn,$gwl,$gwh,wh,$gstack,$gwrt,gra,grb,TestTest,wfor,_ca,_da,_r,_rz,_o,_oz,_1,_1z,_2,_2z,_m,_mz,nv_getDate,nv_getRegExp,nv_console,nv_parseInt,nv_parseFloat,nv_isNaN,nv_isFinite,nv_decodeURI,nv_decodeURIComponent,nv_encodeURI,nv_encodeURIComponent,$gdc,nv_JSON,_af,_gv,_ai,_grp,_gd,_gapi,$ixc,_ic,_w,_ev,_tsd){return function(path,global){
if(typeof global==='undefined'){if (typeof __GWX_GLOBAL__==='undefined')global={};else global=__GWX_GLOBAL__;}if(typeof __WXML_GLOBAL__ === 'undefined') {__WXML_GLOBAL__={};
}__WXML_GLOBAL__.modules = __WXML_GLOBAL__.modules || {};
var e_={}
if(typeof(global.entrys)==='undefined')global.entrys={};e_=global.entrys;
var d_={}
if(typeof(global.defines)==='undefined')global.defines={};d_=global.defines;
var f_={}
if(typeof(global.modules)==='undefined')global.modules={};f_=global.modules || {};
var p_={}
__WXML_GLOBAL__.ops_cached = __WXML_GLOBAL__.ops_cached || {}
__WXML_GLOBAL__.ops_set = __WXML_GLOBAL__.ops_set || {};
__WXML_GLOBAL__.ops_init = __WXML_GLOBAL__.ops_init || {};
var z=__WXML_GLOBAL__.ops_set.$gwx_XC_25 || [];
function gz$gwx_XC_25_1(){
if( __WXML_GLOBAL__.ops_cached.$gwx_XC_25_1)return __WXML_GLOBAL__.ops_cached.$gwx_XC_25_1
__WXML_GLOBAL__.ops_cached.$gwx_XC_25_1=[];
(function(z){var a=11;function Z(ops){z.push(ops)}
Z([[7],[3,'load']])
Z([a,[3,'usb '],[[2,'?:'],[[2,'=='],[[7],[3,'show_type']],[1,1]],[1,'usb-bgd'],[1,'']]])
Z([[2,'=='],[[7],[3,'show_type']],[1,1]])
Z([3,'main'])
Z(z[2])
Z([[7],[3,'usbList']])
Z([3,'index'])
Z([[7],[3,'refundtext']])
Z([[2,'=='],[[7],[3,'show_type']],[1,2]])
Z([[7],[3,'showDetailBtn']])
Z(z[2])
Z([[2,'!'],[[7],[3,'load']]])
Z(z[7])
})(__WXML_GLOBAL__.ops_cached.$gwx_XC_25_1);return __WXML_GLOBAL__.ops_cached.$gwx_XC_25_1
}
__WXML_GLOBAL__.ops_set.$gwx_XC_25=z;
__WXML_GLOBAL__.ops_init.$gwx_XC_25=true;
var x=['./pages/home-module/usb-cable/index.wxml'];d_[x[0]]={}
var m0=function(e,s,r,gg){
var z=gz$gwx_XC_25_1()
var xKG=_v()
_(r,xKG)
if(_oz(z,0,e,s,gg)){xKG.wxVkey=1
var fMG=_n('view')
_rz(z,fMG,'class',1,e,s,gg)
var cNG=_v()
_(fMG,cNG)
if(_oz(z,2,e,s,gg)){cNG.wxVkey=1
}
var oPG=_n('view')
_rz(z,oPG,'class',3,e,s,gg)
var cQG=_v()
_(oPG,cQG)
if(_oz(z,4,e,s,gg)){cQG.wxVkey=1
var lSG=_v()
_(cQG,lSG)
var aTG=function(eVG,tUG,bWG,gg){
var xYG=_v()
_(bWG,xYG)
if(_oz(z,7,eVG,tUG,gg)){xYG.wxVkey=1
}
xYG.wxXCkey=1
return bWG
}
lSG.wxXCkey=2
_2z(z,5,aTG,e,s,gg,lSG,'item','index','index')
}
var oRG=_v()
_(oPG,oRG)
if(_oz(z,8,e,s,gg)){oRG.wxVkey=1
var oZG=_v()
_(oRG,oZG)
if(_oz(z,9,e,s,gg)){oZG.wxVkey=1
}
oZG.wxXCkey=1
}
cQG.wxXCkey=1
oRG.wxXCkey=1
_(fMG,oPG)
var hOG=_v()
_(fMG,hOG)
if(_oz(z,10,e,s,gg)){hOG.wxVkey=1
}
cNG.wxXCkey=1
hOG.wxXCkey=1
_(xKG,fMG)
}
var oLG=_v()
_(r,oLG)
if(_oz(z,11,e,s,gg)){oLG.wxVkey=1
var f1G=_v()
_(oLG,f1G)
if(_oz(z,12,e,s,gg)){f1G.wxVkey=1
}
f1G.wxXCkey=1
}
xKG.wxXCkey=1
oLG.wxXCkey=1
return r
}
e_[x[0]]=e_[x[0]]||{f:m0,j:[],i:[],ti:[],ic:[]}
if(path&&e_[path]){
return function(env,dd,global){$gwxc=0;var root={"tag":"wx-page"};root.children=[]
;g="$gwx_XC_25";var main=e_[path].f
if (typeof global==="undefined")global={};global.f=$gdc(f_[path],"",1);
try{
main(env,{},root,global);
_tsd(root)
}catch(err){
console.log(err)
}
;g="";
return root;
}
}
}
}(__g.a,__g.b,__g.c,__g.d,__g.e,__g.f,__g.g,__g.h,__g.i,__g.j,__g.k,__g.l,__g.m,__g.n,__g.o,__g.p,__g.q,__g.r,__g.s,__g.t,__g.u,__g.v,__g.w,__g.x,__g.y,__g.z,__g.A,__g.B,__g.C,__g.D,__g.E,__g.F,__g.G,__g.H,__g.I,__g.J,__g.K,__g.L,__g.M,__g.N,__g.O,__g.P,__g.Q,__g.R,__g.S,__g.T,__g.U,__g.V,__g.W,__g.X,__g.Y,__g.Z,__g.aa);if(__vd_version_info__.delayedGwx||false)$gwx_XC_25();	if (__vd_version_info__.delayedGwx) __wxAppCode__['pages/home-module/usb-cable/index.wxml'] = [$gwx_XC_25, './pages/home-module/usb-cable/index.wxml'];else __wxAppCode__['pages/home-module/usb-cable/index.wxml'] = $gwx_XC_25( './pages/home-module/usb-cable/index.wxml' );
	;__wxRoute = "pages/home-module/usb-cable/index";__wxRouteBegin = true;__wxAppCurrentFile__="pages/home-module/usb-cable/index.js";define("pages/home-module/usb-cable/index.js",function(require,module,exports,window,document,frames,self,location,navigator,localStorage,history,Caches,screen,alert,confirm,prompt,XMLHttpRequest,WebSocket,Reporter,webkit,WeixinJSCore){
"use strict";var e,t=require("../../../@babel/runtime/helpers/interopRequireDefault"),a=require("../../../@babel/runtime/helpers/objectDestructuringEmpty"),r=t(require("../../../@babel/runtime/regenerator")),i=require("../../../@babel/runtime/helpers/asyncToGenerator"),s=require("../../../@babel/runtime/helpers/defineProperty"),n=getApp(),o=(require("../../../utils/util"),require("../../../wxParse/wxParse.js")),d="",c=!1;Component({options:{styleIsolation:"apply-shared"},properties:{deviceNo:{type:String}},data:(e={times:0,time_show:"",refundtext:!0},s(e,"times",0),s(e,"time_show",""),s(e,"show_type",1),s(e,"device_id",""),s(e,"usbList",[]),s(e,"currTid",""),s(e,"currid",""),s(e,"password",""),s(e,"frequency_surplus",""),s(e,"showDetailBtn",!1),s(e,"price_chagre",""),s(e,"is_payer",-1),s(e,"orderInfo",""),s(e,"order_id",""),s(e,"btn_loading",!0),e),ready:function(){this.__init()},methods:{__init:function(){var e=this;return i(r.default.mark((function t(){var a,i,s;return r.default.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(e.setData({load:!1}),e.data.deviceNo){t.next=5;break}return n.showToast("设备信息错误，请扫码重试2222222"),t.abrupt("return");case 5:return a=wx.getStorageSync("phoneConfig")||"",e.setData({phoneConfig:a}),clearInterval(d),e.getConfig(),t.next=11,e.getGoodsList();case 11:i=t.sent,s=i.device_id,e.setData({device_id:s}),e.getChargeList(),e.getOrderInfo();case 16:case"end":return t.stop()}}),t)})))()},refundShow:function(){var e=this.data.refundtext;this.setData({refundtext:!e})},getConfig:function(){var e=this;n.ajax({url:"api/Article/detail",data:{column_code:"AC1DwRhc"},success:function(t){if(1e3==t.data.code){var a=t.data.data.content;o.wxParse("article","html",a,e,5)}}})},getGoodsList:function(){var e=this;return new Promise((function(t,a){var r=e.data.deviceNo;n.ajax({url:"User/Shop/goodsList",data:{device_no:r},success:function(r){if(1e3==r.data.code){var i=r.data.data,s=i.device_address,o=i.device_id;e.triggerEvent("setParamValue",{device_address:s,hasMore:!1}),e.setData({device_id:o}),t({device_id:o})}else n.showToast(r.data.msg+"，请扫码重试"),a()}})}))},getChargeList:function(){var e=this,t=this.data.device_id;n.ajax({url:"User/Shop/deviceChargeList",data:{device_id:t,version:2},success:function(t){if(1e3==t.data.code){var a=t.data.data;e.setData({usbList:a,currTid:a[0].id,currid:a[0].content[0].id,price_chagre:a[0].content[0].fee_per_hour,img_length:Math.ceil(0)})}else n.showToast(t.data.msg)}})},toPayFun:function(){var e=this;return i(r.default.mark((function t(){var a,i,s,o;return r.default.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(!c){t.next=2;break}return t.abrupt("return");case 2:if(c=!0,a=e.data.is_payer,t.prev=4,0!=a){t.next=9;break}return n.showToast("设备已被占用，请稍后再试"),c=!1,t.abrupt("return");case 9:return t.next=11,e.createOrder();case 11:return i=t.sent,console.log(i),t.next=15,e.confirmPay(i);case 15:s=t.sent,o=s.msg,n.showToast(o),c=!1,e.getPassword({order_id:i.order_id}),t.next=26;break;case 22:t.prev=22,t.t0=t.catch(4),n.showToast(t.t0.msg),c=!1;case 26:case"end":return t.stop()}}),t,null,[[4,22]])})))()},createOrder:function(){var e=this;return new Promise((function(t,a){var r=e.data,i=r.currid,s=r.device_id,o=r.currTid;n.ajax({url:"User/Order/order",data:{id:o,device_id:s,pay_way:1,order_type:2,charge_id:i},success:function(e){1e3==e.data.code?(console.log("生成订单",e.data.data),t(e.data.data)):a(e.data)}})}))},confirmPay:function(e){var t=this;return new Promise((function(r,i){a(t.data),n.ajax({url:"User/Order/comfirmPay",data:{order_id:e.order_id},success:function(t){console.log("确认支付",t.data.data),1e3==t.data.code?wx.requestPayment({timeStamp:e.timeStamp,nonceStr:e.nonceStr,package:e.package,signType:e.signType,paySign:e.paySign,success:function(e){r({msg:"支付成功"})},fail:function(e){i({msg:"支付失败，请重试"})},complete:function(e){}}):1100==t.data.code?r({msg:"订单已成功"}):i(t.data)}})}))},getOrderInfo:function(){var e=this;return new Promise((function(t,a){var r=e.data,i=r.order_id,s=r.device_id,o=e.data.deviceNo;n.ajax({url:"user/Charger/getChargeInfo",data:{device_id:s,order_id:i,device_no:o},success:function(r){if(wx.stopPullDownRefresh(),1e3==r.data.code){console.log("查询订单",r.data.data);var i=r.data.data.is_payer;if(1==i){var s=r.data.data,n=s.password,o=s.frequency;e.setData({orderInfo:r.data.data,show_type:2,password:n,frequency_surplus:5-o>=0?5-o:0,load:!0,btn_loading:!1}),e.changeTime(r.data.data)}else e.setData({show_type:1,load:!0});e.setData({is_payer:i}),t()}else e.setData({show_type:1,load:!0,is_payer:-1}),a()}})}))},getPassword:function(e){var t=this;return console.log(this.data.btn_loading),this.setData({btn_loading:!0}),new Promise((function(a,r){var i=e.order_id,s=e.device_id,o=t.data.deviceNo;n.ajax({url:"user/Charger/getChargeCode",data:{device_id:s,order_id:i,device_no:o},success:function(e){if(1e3==e.data.code){console.log("获取密码接口",e.data.data);var i=e.data.data,s=i.password,n=i.frequency;t.setData({orderInfo:e.data.data,show_type:2,password:s,frequency_surplus:5-n>=0?5-n:0,btn_loading:!1}),t.changeTime(e.data.data),a()}else r({msg:e.data.msg})}})}))},getResetPwd:function(){var e=this;return i(r.default.mark((function t(){var a,i,s,o;return r.default.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:a=e.data,i=a.device_id,s=a.order_id,(o={}).device_id=i,o.order_id=s,n.ajax({url:"user/Charger/resetChargeCode",data:{device_id:i},success:function(t){1e3==t.data.code?(e.getPassword(o),wx.showModal({title:"解锁密码",content:"请在当前设备上输入解锁密码"+t.data.data.password+"操作完成后，再输"+e.data.password+"入码即可充电",showCancel:!1,confirmText:"确定",confirmColor:"#546993",success:function(t){t.confirm&&e.getOrderInfo({device_id:i})}})):n.showToast(t.data.msg)}});case 5:case"end":return t.stop()}}),t)})))()},getPwdFun:function(){var e=this.data,t=e.frequency_surplus,a=e.device_id,r=e.order_id,i={};i.device_id=a,i.order_id=r,t<=0?n.showToast("获取密码次数已用完"):this.getPassword(i)},checkDetail:function(){var e=this.data.showDetailBtn;this.setData({showDetailBtn:!e})},overCharge:function(){this.getBeforefFinish()},getBeforefFinish:function(){var e=this,t={device_id:this.data.device_id,version:2};n.ajax({url:"User/Charger/before_finish",data:t,success:function(t){1e3==t.data.code?wx.showModal({title:"可退款金额",content:t.data.data.price+"元",showCancel:!0,cancelText:"我再想想",cancelColor:"#000000",confirmText:"确认结束",confirmColor:"#546993",success:function(t){t.confirm&&e.getfinish()}}):n.showToast(t.data.msg)}})},getfinish:function(){var e=this,t={device_id:this.data.device_id,version:2};n.ajax({url:"User/Charger/finish",data:t,success:function(t){1e3==t.data.code?wx.showModal({title:"退款成功",content:t.data.msg,showCancel:!1,confirmText:"确认",confirmColor:"#546993",success:function(t){t.confirm&&e.setData({show_type:1})}}):n.showToast(t.data.msg)}})},changeTime:function(e){var t=e.time,a=e.now,r=parseInt(new Date(a).getTime()/1e3),i=parseInt(new Date(t).getTime()/1e3),s=parseInt(i)-parseInt(r),n=this.timeToString(s);this.setData({times:s,time_show:n}),this.setTimer()},timeToString:function(e){var t=Math.floor(e/86400);e%=86400;var a=Math.floor(e/3600);e%=3600;var r=Math.floor(e/60);e%=60;var i="";return t>0&&(i+="".concat(t)),a>=10?i+="".concat(a):a<10&&a>0&&(i+="0".concat(a)),r>=10?i+="".concat(r):r<10&&r>0&&(i+="0".concat(r)),e>=10?i+="".concat(e):e<10&&e>0&&(i+="0".concat(e)),i},setTimer:function(){var e=this;clearInterval(d),d=setInterval((function(){var t=e.data,a=t.times,r=t.device_id;if(a<=0)clearInterval(d),e.setData({show_type:1}),e.getOrderInfo({device_id:r});else{a--;var i=e.timeToString(a).split("");e.setData({times:a,time_show:i})}}),1e3)},updateDevice:function(e){var t=this,a=wx.getSystemInfoSync();n.ajax({url:"User/User/checkDevice",data:{device_no:e},success:function(r){if(1e3==r.data.code){console.log("更新设备信息",r.data.data);var i={scene:-2001,system:a.system};n.enterApp(i),wx.setStorageSync("device_code",e),wx.setStorageSync("canLoad",!0),wx.setStorageSync("can_query",!0),t.triggerEvent("refreshFun",{})}else n.showToast(r.data.msg)}})},toCallPhone:function(){var e=this.data.phoneConfig;wx.makePhoneCall({phoneNumber:e,success:function(e){},fail:function(){},complete:function(){}})}}});
},{isPage:false,isComponent:true,currentFile:'pages/home-module/usb-cable/index.js'});require("pages/home-module/usb-cable/index.js");